from state import Idle
from event_handler import Event


class WaterTank:
    """水箱类，管理当前状态和事件处理"""
    
    def __init__(self):
        self.state = Idle()  # 初始状态
        self.temperature = 15  # 初始温度

    def set_state(self, state):
        self.state = state

    def trigger(self, event):
        """触发事件，进行状态转换"""
        self.state.handle(self, event)

    def increase_temperature(self, degrees):
        """增加温度"""
        self.temperature += degrees
        print(f"当前温度: {self.temperature}°")

    def decrease_temperature(self, degrees):
        """降低温度"""
        self.temperature -= degrees
        print(f"当前温度: {self.temperature}°")

